package com.han.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @Author: Hanjiafeng
 * @Date: 2020/6/29
 * @Desc:
 */
public class Dealer {
    /**
     * 从数组中随机取出指定数量数据
     *
     * @param array 数组
     * @param count 数量
     * @return 随机值
     */
    public static List<String> roll(List<String> array, int count) {
        List<String> result = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < count; i++) {
            result.add(array.get(random.nextInt(array.size())));
        }
        return result;
    }
}
